define(
    ()=>{
        return function(goodsMsg){
            $(".spcar").on("input",".fxk",function(){
         
             
                const id =  $(this).parent().parent().attr("index");
                  let i = 0;
                  
                goodsMsg.some((val,idx)=>{
                  i=idx;
                 return val.id===id
                });
                  goodsMsg[i].flag =Number(this.checked) ;
           localStorage.setItem("goodsMsg",JSON.stringify(goodsMsg));
           $("#allflag")[0].checked = goodsMsg.every(val=>val.flag);
           let ap = goodsMsg.reduce((start,val)=>val.flag?start+=val.num*val.price:start,0)
        $(".allprice").html(ap);
       
                 })
        }
    }
);